package com.cupster.android_x_frame.test;

public  class TextUtil {


    public static void main(String[] args) {
        System.out.println(withStr("=-="));
        System.out.println(withChar('A'));
        System.out.println(withBoolean(true));
        System.out.println(withDint(100));
        System.out.println(withHex16(0xff22aa));
        System.out.println(withFloat(11.22f));
        System.out.println(withFloat(11.0f));
        System.out.println(with0nd(5 ,11));
        System.out.println(with0nd(5 ,2222));
    }

    //=============  拼接内容  ====================

    public static String withStr(String s){
        return String.format("这是拼接s = %s" ,s);
    }
    public static String withChar(char c){
        return String.format("这是拼接c = %c" ,c);
    }
    public static String withBoolean(boolean b){
        return String.format("这是拼接b= %b" ,b);
    }
    public static String withDint(long l){
        return String.format("这是拼接d= %d" ,l);
    }
    public static String withHex16(int hex16){
        return String.format("这是拼接16进制x= %x" ,hex16);
    }
    public static String withFloat(float f){
        return String.format("这是拼接f= %f" ,f);
    }
    public static String with0nd(int  n ,long d){
        return String.format("这是拼接左补零位数= %05d" ,d);
    }
    //=============  保留位数  ====================

    public  static  String  getDot2f(double num ){
        return String.format("%.2f", 0.0f+ num);
    }
}
